
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Abp.Domain.Entities.Auditing;
using Yozeev.BusinessLogic;

namespace  Yozeev.BusinessLogic.Dtos
{
    public class ScheduleEditDto
    {
		/// <summary>
		/// ScheduleCode
		/// </summary>
		public string ScheduleCode { get; set; }



		/// <summary>
		/// Id
		/// </summary>
		public Guid? Id { get; set; }



        /// <summary>
        /// SaleDate
        /// </summary>
        public DateTime SaleDate { get; set; }



        /// <summary>
        /// StartTime
        /// </summary>
        [Required(ErrorMessage="StartTime不能为空")]
		public DateTime StartTime { get; set; }



        /// <summary>
        /// EndTime
        /// </summary>
		public DateTime EndTime { get; set; }



        /// <summary>
        /// SeatQuantity
        /// </summary>
		public long SeatQuantity { get; set; }



		/// <summary>
		/// SurplusQuantity
		/// </summary>
		public long SurplusQuantity { get; set; }



		/// <summary>
		/// ScheduleStatus
		/// </summary>
		public ScheduleStatusEnum ScheduleStatus { get; set; }



		/// <summary>
		/// AuditStatus
		/// </summary>
		public AuditStatusEnum AuditStatus { get; set; }



		/// <summary>
		/// RouteId
		/// </summary>
		public Guid RouteId { get; set; }



		/// <summary>
		/// BoatId
		/// </summary>
		public Guid BoatId { get; set; }



		/// <summary>
		/// CheckStartTime
		/// </summary>
		public DateTime CheckStartTime { get; set; }



        /// <summary>
        /// CheckEndTime
        /// </summary>
        public DateTime CheckEndTime { get; set; }



        /// <summary>
        /// 预留数
        /// </summary>
        public long ReserveQuantity { get; set; }



        /// <summary>
        /// Route
        /// </summary>
        public Route Route { get; set; }



        /// <summary>
        /// Boat
        /// </summary>
        public Boat Boat { get; set; }


        /// <summary>
        /// 票价ID列表
        /// </summary>
        public List<Guid> TicketIds { get; set; }
        #region 时间格式处理
        public string SaleDateStr { get; set; }
        public string StartTimeStr { get; set; }
        public string EndTimeStr { get; set; }
        public string CheckStartTimeStr { get; set; }
        public string CheckEndTimeStr { get; set; }

        public void SetTime()
        {
            if (SaleDate == DateTime.MinValue && string.IsNullOrWhiteSpace(SaleDateStr))
            {
                SaleDateStr = DateTime.Today.ToString("yyyy-MM-dd");
            }
            if (!string.IsNullOrWhiteSpace(SaleDateStr))
            {
                SaleDate = DateTime.Parse(SaleDateStr);
                SaleDateStr = SaleDate.ToString("yyyy-MM-dd");
            }
            if (!string.IsNullOrWhiteSpace(StartTimeStr))
                if (StartTimeStr.Length >= 19)
                    StartTime = DateTime.Parse(StartTimeStr);
                else
                    StartTime = DateTime.Parse(SaleDateStr + " " + StartTimeStr);
            if (!string.IsNullOrWhiteSpace(EndTimeStr))
                if (EndTimeStr.Length >= 19)
                    EndTime = DateTime.Parse(EndTimeStr);
                else
                    EndTime = DateTime.Parse(SaleDateStr + " " + EndTimeStr);

            if (!string.IsNullOrWhiteSpace(CheckStartTimeStr))
                if (StartTimeStr.Length >= 19)
                    CheckStartTime = DateTime.Parse(CheckStartTimeStr);
                else
                    CheckStartTime = DateTime.Parse(SaleDateStr + " " + CheckStartTimeStr);

            if (!string.IsNullOrWhiteSpace(CheckEndTimeStr))
                if (StartTimeStr.Length >= 19)
                    CheckEndTime = DateTime.Parse(CheckEndTimeStr);
                else
                    CheckEndTime = DateTime.Parse(SaleDateStr + " " + CheckEndTimeStr);
        }
        #endregion

        /// <summary>
        /// 标准仓数量
        /// </summary>
        public long StandardNum { get; set; }
        /// <summary>
        /// 标准仓剩余数
        /// </summary>
        public long StandardSurplusNum { get; set; }
        /// <summary>
        /// 标准仓预留数
        /// </summary>
        public long StandardReserveNum { get; set; }
        /// <summary>
        /// VIP仓数量
        /// </summary>
        public long VIPNum { get; set; }
        /// <summary>
        /// VIP仓剩余数
        /// </summary>
        public long VIPSurplusNum { get; set; }
        /// <summary>
        /// VIP仓预留数
        /// </summary>
        public long VIPReserveNum { get; set; }
        /// <summary>
        /// 包间数量
        /// </summary>
        public long CompartmentNum { get; set; }
        /// <summary>
        /// 包间剩余数量
        /// </summary>
        public long CompartmentSurplusNum { get; set; }
        /// <summary>
        /// 包间预留数
        /// </summary>
        public long CompartmentReserveNum { get; set; }
        /// <summary>
        /// 航班销售状态
        /// </summary>
        public ScheduleEnum ScheduleSaleStatus { get; set; }
        /// <summary>
        /// 预留票数备注
        /// </summary>
        public string Remark { get; set; }
    }
}